define([
    "dojo/_base/declare",
    "gistech/widgets/normalDialog/NormalDialog",
    "dojo/text!./templates/Template.html",
    "dojo/_base/lang",
    "dojo/dom-style",
    "dojo/dom-construct",
    "dojo/on",
    "dojo/_base/connect",
    "gistech/util/ajaxUtil",
    "dojo/dom-style","dojo/query","dojo/dom-class",
    "../UserSet/UserSet","dojo/topic"],
    function(declare,NormalDialog,template,lang,style,domConstruct,on,eventconnect,ajaxUtil,domStyle,query,domClass,UserSet,topic){
        return declare([NormalDialog],{
        	
            templateString:template,
            container:null,
            resetAttr:function(){
                this.inherited(arguments);
            },

            constructor:function (args) {
            	this.inherited(arguments);
            	this.container = args.container;
            	this.companyNode=null,
            	this.businessNode=null,
            	this.developmentNode=null,
            	
            	//
               	this.allVehicleData = new Object();
                this.map = args.map;
                this.container = args.container;
                this.currentPage=1;
                this.totalPage=1;
                this.currentSource=[];
                this.companyOptionHTML = "<option selected=\"selected\" value=\"\">请选择</option>";
                this.departmentOptionHTML = "<option selected=\"selected\" value=\"\">请选择</option>";
                
                this.organizationName = args.organizationName;
  			    this.typeName = args.typeName,
			    this.parentName = args.parentName,
			    this.menagerName = args.menagerName,
			    this.organizationId = args.organizationId,
			    this.menagerId = args.menagerId,
			    this.parentId = args.parentId
            },
            
            postCreate:function(){
                this.inherited(arguments);
                //domConstruct.place(this.domNode, this.container);
                this.init();
                this.addEvents();

            },

            /**
             * 初始化
             */
            init:function () {

            },
            
            
            addEvents:function(){
            	on(this.userPwdBtnOk,"click",dojo.hitch(this,this.changeUserPwd));
            },
            
 
 
 
 
 

            changeUserPwd:function(){
            	
            	var oldPwd = dojo.byId("oldPwd").value;
            	var newPwd = dojo.byId("newPwd").value;
            	var newPwds = dojo.byId("newPwds").value;
 
            	
            	var menagerUserId = this.menagerId;
            	if(oldPwd=='' || newPwd=='' || newPwds=='' ){
            		alert('原密码/新密码不能为空');
            		return false;
            	}
            	if(newPwd!=newPwds){
            		alert('新密码不一致');
            		return false;
            	}

            	var	url ="../client/backgroundManagement/userController/updatePwd"
            	var param ="oldPwd="+oldPwd+"&newPwd="+newPwd+"&userId="+ioc.map.userInfoData.USERID;
            	
            	//
            	ajaxUtil.request(url,param,lang.hitch(this,function(result){
            		if(result.success){
            			alert('操作成功')
            			this.destroy();
            			
            		}else{
            			alert(result.msg);
            		}
            	}),function(){
            		alert('操作失败');
                    console.error("修改密码失败");
                });
            },
            
 
            startup:function(){
                this.inherited(arguments);
            },
            closeDialog:function(){
    			this.inherited("closeDialog",arguments);
    			this.destroy();
    		}

    });
});

